<%@ page import="com.jr.entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="stylesheet" href="css/personal.css"/>
    <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="js/personal.js"></script>
    <link type="text/css" rel="stylesheet" href="css/message.css" />
    <script type="text/javascript" src="js/message.min.js"></script>
    <style type="text/css">
        .typeJob2{ float:left;width: 47px;height: 32px;line-height: 30px;text-align: center;border: 1px solid #D9DBD8;background: #FFF;border-radius: 2px;cursor: pointer; margin-right: 5px;}
        .typeJob2.on{background:url(images/log29.png) no-repeat;color: #0BC10A; border:none;width: 47px;height: 31px;}
        .typeJob1{ float:left;width: 47px;height: 32px;line-height: 30px;text-align: center;border: 1px solid #D9DBD8;background: #FFF;border-radius: 2px;cursor: pointer; margin-right: 5px;}
        .typeJob1.on{background:url(images/log29.png) no-repeat;color: #0BC10A; border:none;width: 47px;height: 31px;}
    </style>
    <script type="text/javascript">
        function logout(){
            location.href="user/logout";
        }
        $(document).on("click",".typeJob2",function(){
            if($(this).attr("class")=="typeJob2 on"){
                $('.typeJob2').addClass('on');
                $(this).removeClass('on');
            }else
            {
                $('.typeJob2').removeClass('on');
                $(this).addClass('on');
            }
        })

        $(document).on("click",".typeJob1",function(){
            if(!($(this).attr("class")=="typeJob1 on")){
                $('.typeJob1').removeClass('on');
                $(this).addClass('on');
            }
        })

        $(document).ready(function () {

                var user = <%=session.getAttribute("user1")%>;
                var obj = null;
                $(".Info").empty();
                if(user==null||user=="null"){
                    $.message({
                        message:"请先登录",
                        time:1500,
                        type:"warning"
                    });
                    setTimeout(function () {
                        location.href="login.jsp";
                    },1500);
                    return false;
                }

                if(user!=null){
                    obj = "<font>"+user.uname+"</font>\n" +
                        "                    <input type=\"button\">\n" +
                        "                    <div id=\"InfoPopup\">\n" +
                        "                        <ul>\n" +
                        "                            <li><a href=\"index.jsp\" onclick=\"logout();\">退出</a></li>\n" +
                        "                        </ul>\n" +
                        "                    </div>";
                }
                $(obj).appendTo(".Info");

            $("#saveBtn").on("click", function () {
                var username = $("#username").val();
                var sex = "男";
                if ($("#SexBoy").hasClass("sex on")) {
                    sex = $("#SexBoy").text();
                } else if ($("#SexGirl").hasClass("sex on")) {
                    sex = $("#SexGirl").text();
                }
                var place = $("#place").val();
                var domicile = $("#domicile").val();
                var birthplace = $("#birthplace").val();
                var phone = $("#phone").text();
                var email = $("#email").val();
                var jobstatus = $("#txtcon2").find("option:selected").val();
                var workexperience = "0";
                if ($("#WorkExperienceHav").hasClass("typeJob2 on")) {
                    workexperience = "0";
                } else if ($("#WorkExperienceNon").hasClass("typeJob2 on")) {
                    workexperience = "1";
                }
                var worknature = "0";
                if ($("#WorkNatureFull").hasClass("typeJob1 on")) {
                    worknature = "0";
                } else if ($("#WorkNaturePart").hasClass("typeJob1 on")) {
                    worknature = "1";
                } else if ($("#WorkNaturePractice").hasClass("typeJob1 on")) {
                    worknature = "2";
                }
                var expectedsalary = $("#txtcon3").find("option:selected").val();
                var workplace = $("#workplace").val();
                var jobcategory = $("#jobcategory").val();
                var schoolname = $("#schoolname").val();
                var educationalbackground = $("#txtcon4").find("option:selected").val();
                var educationaltype = $("#txtcon5").find("option:selected").val();
                var majorname = $("#majorname").val();
                var professionalcategory = $("#txtcon6").find("option:selected").val();
                $.post("user/changeUser", {
                    "uid" : "1", <%--${user.uid}--%>
                    "uname": username,
                    "usex": sex,
                    "uplace": place,
                    "udomicile": domicile,
                    "ubirthplace": birthplace,
                    "uphone": phone,
                    "uemail": email,
                    "ujobstatus": jobstatus,
                    "uworkexperience": workexperience,
                    "uworknature": worknature,
                    "uexpectedsalary": expectedsalary,
                    "uworkplace": workplace,
                    "ujobcategory": jobcategory,
                    "uschoolname": schoolname,
                    "ueducationalbackground": educationalbackground,
                    "ueducationaltype": educationaltype,
                    "umajorname": majorname,
                    "uprofessionalcategory": professionalcategory
                }, function (status) {
                    if(status=="1"){
                        $.message({
                            message:"修改成功",
                            time:1500,
                            type:"success"
                        })
                        setTimeout(function () {
                            location.href="index.jsp";
                        },1500);

                    }else {
                        $.message({
                            message:"修改失败",
                            time:1500,
                            type:"error"
                        })
                        setTimeout(function () {
                            location.href="personal_resume.jsp";
                        },1500);
                    }
                });
            });
        })
    </script>
    <title>个人中心-我的简历</title>
</head>
<body>
<div class="header">
    <div class="headerMain">
        <div class="Notice">
        </div>
        <div class="Account">
            <div class="Left">
                <div class="Info">
                    <font>[28421947]</font>
                    <input type="button">
                    <div id="InfoPopup">
                        <ul>
                            <li><a href="index.jsp" onclick="logout();">退出</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="navTop">
    <div class="navTopmain">
        <div class="logo"><a href="index.jsp"><img src="images/logo_1.png"/><img src="images/logo_2.png"/></a></div>
    </div>
</div>
<div class="personalBody">

    <div id="base_div" class="perRightcon">
        <div class="JlBoxTit">
            <p class="tit1">基本资料/求职意向</p>
            <div class="tit2"></div>
            <p class="tit3">最高学历</p>
        </div>
        <div class="JlBoxCon">
            <h1><span>基本信息</span>
                <div></div>
            </h1>
            <div class="JlBoxLeft">
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>姓 名：</div>
                    <div class="inputtxt">
                        <input name="" type="text" class="txt1" id="username" value="${user.uname}"/>
                        <%--                        ${user.uname}--%>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>性 别：</div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            if ("男" == "${user.usex}") {
                                <%--                                ${user.usex}--%>
                                $("#SexBoy").attr("class", "sex on");
                                $("#SexGirl").attr("class", "sex");
                            } else if ("女" == "${user.usex}") {
                                $("#SexBoy").attr("class", "sex");
                                $("#SexGirl").attr("class", "sex on");
                            }
                        })
                    </script>
                    <div class="inputtxt" id="sexx">
                        <div class="sex on" id="SexBoy">男</div>
                        <div class="sex" id="SexGirl">女</div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>出生年月：</div>
                    <div class="inputtxt">
                        <input name="" type="date" id="date_info" class="txt8" value="<fmt:formatDate value="${user.ubirthday}"
                                                                              pattern="yyyy-MM-dd"/>"/>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>现居住地：</div>
                    <div class="inputtxt">
                        <input name="" id="place" type="text" class="txt7" value="${user.uplace}"/>
                        <%--                        ${user.uplace}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>户口所在地：</div>
                    <div class="inputtxt">
                        <input name="" id="domicile" type="text" class="txt7" value="${user.udomicile}"/>
                        <%--                        ${user.udomicile}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>我成长在：</div>
                    <div class="inputtxt">
                        <input name="" id="birthplace" type="text" class="txt7" value="${user.ubirthplace}"/>
                        <%--                        ${user.ubirthplace}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>手机号码：</div>
                    <div class="inputtxt">
                        <span class="phone" id="phone">${user.uphone}</span>
                        <%--                        ${user.uphone}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>电子邮箱：</div>
                    <div class="inputtxt">
                        <input name="" type="text" id="email" class="txt3" value="${user.uemail}"/>
                        <%--                        ${user.uemail}--%>
                        <b>可用来登录</b>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
        <div class="JlBoxCon">
            <h1><span>求职意向</span>
                <div></div>
            </h1>
            <div class="JlBoxLeft">
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>求职状态：</div>
                    <div class="inputtxt">
                        <script type="text/javascript">
                            $(document).ready(function () {
                                $("#txtcon2").val("${user.ujobstatus}");
                                <%--${user.ujobstatus}--%>
                            })
                        </script>
                        <select class="txtcon txt2" id="txtcon2">
                            <option value="0">离职-随时到岗</option>
                            <option value="1">在职-月内到岗</option>
                            <option value="2">在职-考虑机会</option>
                            <option value="3">在职-暂不考虑</option>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>相关工作经验：</div>
                    <div class="inputtxt" id="inputtxt1">
                        <script type="text/javascript">
                            $(document).ready(function () {
                                if ("0" == "${user.uworkexperience}") {
                                    <%--                                    ${user.uworkexperience}--%>
                                    $("#WorkExperienceHav").attr("class", "typeJob2");
                                    $("#WorkExperienceNon").attr("class", "typeJob2 on");
                                } else if ("1" == "${user.uworkexperience}") {
                                    $("#WorkExperienceHav").attr("class", "typeJob2 on");
                                    $("#WorkExperienceNon").attr("class", "typeJob2");
                                }
                            })
                        </script>
                        <div class="typeJob2 on" id="WorkExperienceHav">有</div>
                        <div class="typeJob2" id="WorkExperienceNon">无</div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>期望工作性质：</div>
                    <div class="inputtxt" id="inputtxt2">
                        <script type="text/javascript">
                            $(document).ready(function () {
                                if ("0" == "${user.uworknature}") {
                                    <%--                                    ${user.uworknature}--%>
                                    $("#WorkNatureFull").attr("class", "typeJob1 on");
                                    $("#WorkNaturePart").attr("class", "typeJob1");
                                    $("#WorkNatureFull").attr("class", "typeJob1");
                                    $("#WorkNaturePractice").attr("class", "typeJob1");
                                } else if ("1" == "${user.uworknature}") {
                                    $("#WorkNatureFull").attr("class", "typeJob1");
                                    $("#WorkNaturePart").attr("class", "typeJob1 on");
                                    $("#WorkNatureFull").attr("class", "typeJob1");
                                    $("#WorkNaturePractice").attr("class", "typeJob1");
                                } else if ("2" == "${user.uworknature}") {
                                    $("#WorkNatureFull").attr("class", "typeJob1");
                                    $("#WorkNaturePart").attr("class", "typeJob1");
                                    $("#WorkNatureFull").attr("class", "typeJob1");
                                    $("#WorkNaturePractice").attr("class", "typeJob1 on");
                                }
                            })
                        </script>
                        <div class="typeJob1 on" id="WorkNatureFull">全职</div>
                        <div class="typeJob1" id="WorkNaturePart">兼职</div>
                        <div class="typeJob1" id="WorkNaturePractice">实习</div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>期望月薪：</div>
                    <div class="inputtxt">
                        <select class="txtcon txt2" id="txtcon3">
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#txtcon3").val("${user.uexpectedsalary}");
                                    <%--${user.uexpectedsalary}--%>
                                })
                            </script>
                            <option value="0">面议</option>
                            <option value="1">30000以上</option>
                            <option value="2">20000-30000</option>
                            <option value="3">10000-20000</option>
                            <option value="4">5000-10000</option>
                            <option value="5">5000以下</option>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>期望工作地点：</div>
                    <div class="inputtxt">
                        <input name="" id="workplace" type="text" class="txt7" value="${user.uworkplace}"/>
                        <%--                        ${user.uworkplace}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>期望职位类别：</div>
                    <div class="inputtxt">
                        <input name="" id="jobcategory" type="text" class="txt7" value="${user.ujobcategory}"/>
                        <%--                        ${user.ujobcategory}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <button id="next_btn" class="nextBtn">进一步完善</button>
                </div>
            </div>
        </div>
    </div>
    <div id="education_div" class="perRightcon" hidden>
        <div class="JlBoxTit">
            <p class="tit1">基本资料/求职意向</p>
            <div class="tit2"></div>
            <p class="tit3 on">最高学历</p>
        </div>
        <div class="JlBoxCon">
            <h1><span>最高学历</span>
                <div></div>
            </h1>
            <div class="JlBoxLeft">
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>学校名称：</div>
                    <div class="inputtxt">
                        <input name="" id="schoolname" type="text" class="txt3" value="${user.uschoolname}"/>
                        <%--                        ${user.uschoolname}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>毕业时间：</div>
                    <div class="inputtxt">
                        <input id="graduation_time" name="" type="date" class="txt8" value="<fmt:formatDate value="${user.ugraduationtime}"
                                                                              pattern="yyyy-MM-dd"/>"/>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>学历：</div>
                    <div class="inputtxt">
                        <select class="txtcon txt2" id="txtcon4">
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#txtcon4").val("${user.ueducationalbackground}");
                                    <%--${user.ueducationalbackground}--%>
                                })
                            </script>
                            <option value="A">初中及一下</option>
                            <option value="B">中专/中技</option>
                            <option value="C">高中</option>
                            <option value="D">大专</option>
                            <option value="E">硕士</option>
                            <option value="F">本科</option>
                            <option value="G">博士</option>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>学历类型：</div>
                    <div class="inputtxt">
                        <select class="txtcon txt2" id="txtcon5">
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#txtcon5").val("${user.ueducationaltype}");
                                    <%--${user.ueducationaltype}--%>
                                })
                            </script>
                            <option value="A">普通高等教育（统招）</option>
                            <option value="B">普通专升本（统招）</option>
                            <option value="C">成人高考</option>
                            <option value="D">自考</option>
                            <option value="E">电大</option>
                            <option value="F">网络教育</option>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>专业名称：</div>
                    <div class="inputtxt">
                        <input name="" id="majorname" type="text" class="txt3" value="${user.umajorname}"/>
                        <%--                        ${user.umajorname}--%>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <div class="nametxt"><span>*</span>专业类别：</div>
                    <div class="inputtxt">
                        <select class="txtcon txt2" id="txtcon6">
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#txtcon6").val("${user.uprofessionalcategory}");
                                    <%--${user.uprofessionalcategory}--%>
                                })
                            </script>
                            <option value="哲学">哲学</option>
                            <option value="经济学">经济学</option>
                            <option value="法学">法学</option>
                            <option value="教育学">教育学</option>
                            <option value="文学">文学</option>
                            <option value="历史学">历史学</option>
                            <option value="理学">理学</option>
                            <option value="工学">工学</option>
                            <option value="农学">农学</option>
                            <option value="医学">医学</option>
                            <option value="军事学">军事学</option>
                            <option value="管理学">管理学</option>
                            <option value="艺术学">艺术学</option>
                        </select>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="jldiv">
                    <button class="saveBtn" id="saveBtn">填写完毕</button>
                    <button id="previous_btn" class="preBtn">上一步</button>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="clear"></div>
<div class="footer">
</div>
</body>
<script>
    $(function () {
        $("#next_btn").on("click", function () {
            $("#base_div").hide();
            $("#education_div").show();
        });
        $("#previous_btn").on("click", function () {
            $("#base_div").show();
            $("#education_div").hide();
        });

    });
</script>
</html>
